package com.bitdf.txing.chat.feign;

import com.bitdf.txing.chat.config.FeignInterceptor;
import com.bitdf.txing.chat.to.GroupRequestAddTo;
import com.bitdf.txing.common.utils.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author Lizhiwei
 * @date 2023/2/3 16:54:00
 * 注释：
 */
@FeignClient(
        name = "tx-group",                 // 服务名称
        configuration = FeignInterceptor.class       // 请求拦截器 （关键代码）
)
public interface ChatGroupFeignService {
    /**
     * 通过组团id获取所有成员id
     * @param groupId
     * @return
     */
    @GetMapping("/txing/group/member/get")
    public R getMemberIdsByGroupId(@RequestParam("groupId") Long groupId);
    /**
     * 获取某用户的群及用户信息
     * @param userId
     * @return
     */
    @GetMapping("/txing/group/member/group/user/get")
    public R getGroupAndUserIdsByUserId(@RequestParam("userId") Long userId);

    /**
     * 保存组团申请
     * @param groupRequestAdd
     * @return
     */
    @PostMapping("/txing/group/request/add")
    public R save(@RequestBody GroupRequestAddTo groupRequestAdd);

    /**
     * 同意申请加入请求之修改状态
     * @param id
     * @return
     */
    @GetMapping("/txing/group/request/agree")
    public R agreeGroupRequest(@RequestParam("id") Long id);

    @GetMapping("/txing/group/request/reject")
    public R rejectGroupRequest(@RequestParam("id") Long id);

    /**
     * 同意申请加入请求之 加入成员
     * @param groupId
     * @param userId
     * @return
     */
    @GetMapping("/txing/group/member/save")
    public R addGroupMember(@RequestParam("groupId") Long groupId,@RequestParam("userId") Long userId);

}
